package main

import (
	"Blog/database"
	"Blog/model"
	"Blog/router"
	"fmt"
	"github.com/kataras/iris/v12"
	_ "github.com/kataras/iris/v12/context"
)

func main() {
	if !database.DbInit() {
		fmt.Println("数据库初始化失败")
		return
	}
	model.GetConfig()
	model.GetMenu()
	app := iris.New()
	app.Logger()
	app.RegisterView(iris.HTML("./view/blog", ".html").Reload(true))
	app.HandleDir("/", "./public")
	router.Register(app)
	//app.Get("/", index)
	err := app.Run(iris.Addr(":8801"))
	if err != nil {
		fmt.Println(err)
		return
	}
}
